'''
Created on Feb 22, 2014

@author: yfrank
'''

class Enum(object):

    def __init__(self,_type=0,desc=None):
        self.type = _type
        self.desc = desc

    def __str__(self):
        if self.desc:
            return "("+self.__class__.__name__+" : "+self.desc+")"
        else:
            return str(self.type)


class Event(Enum):
    def __init__(self,_type,desc):
        super(Event,self).__init__(_type,desc)

class State(Enum):
    def __init__(self,_type,desc):
        super(State,self).__init__(_type,desc)


class PeerEvent(object):

    DISC = Event(1,"DISC")
    CONN = Event(2,"CONN")
    RECV = Event(3,"RECV")
    SEND = Event(4,"SEND")
    SUCC = Event(5,"SUCC")
    FAIL = Event(6,"FAIL")




class PeerState(object):

    CLOSE = State(1,"CLOSE")
    OPEN  = State(2,"OPEN")
    BUSY  = State(3,"BUSY")



